//
//  Macros.h
//  QiYeJia
//
//  Created by Demon
//  Copyright © 2017年 Demon. All rights reserved.
//

#ifndef Macros_h
#define Macros_h

// 屏宽
#define kScreenW [[UIScreen mainScreen] bounds].size.width
// 屏高
#define kScreenH [[UIScreen mainScreen] bounds].size.height
// 状态栏的高度
#define kStatusHeight [[UIApplication sharedApplication] statusBarFrame].size.height
// 导航栏的高度
#define naviHeight 44.0
// 状态栏 + 导航栏 的高度
#define kNavHeight  (kStatusHeight + naviHeight)
// tabbar的高度
#define kTarBarHeight YDMainTabbarVC.tabBar.frame.size.height
// 指示器的高度
#define kiPhoneXIndicatorHeight (iPhoneX ? 34.0 : 0)
// 是否为iOS11系统
#define iOS11Least ([UIDevice systemVersion] >= 11.0 ? YES : NO)
// 适配比例
#define SCREEN_RATIO_CEIL(a) (ceil((((int)kScreenW == 320 || [UIDevice currentDevice].isPad) ? (320.0 / 375) : (((int)kScreenW == 375) ? 1.0 : (414.0 / 375))) * (a) ))//向上取整

#define FONT_RATIO(a)  ((((int)kScreenW == 320 || [UIDevice currentDevice].isPad)) ? (320.0 / 375) : (((int)kScreenW == 375) ? 1.0 : (414.0 / 375))) * (a))

// 常规字体大小
#define UIFONTSIZE(font) [UIFont systemFontOfSize:font]
// 创建alloc
#define ALLOC(view) [[view alloc] init]
// NSUserDefaults
#define UserDefaults [NSUserDefaults standardUserDefaults]
// UIApplication
#define UIAPPLICATION [UIApplication sharedApplication]
// window
#define WINDOW [[UIAPPLICATION delegate] window]

#define storyBoard [UIStoryboard storyboardWithName:@"Main" bundle:nil]
#define MainStoryBoardVC(vc) [storyBoard instantiateViewControllerWithIdentifier:vc]

#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ?            CGSizeEqualToSize(CGSizeMake(640,960), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640,1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (CGSizeEqualToSize(CGSizeMake(750,1334), [[UIScreen mainScreen] currentMode].size) || CGSizeEqualToSize(CGSizeMake(640,1136), [[UIScreen mainScreen] currentMode].size)) : NO)
#define iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (CGSizeEqualToSize(CGSizeMake(1125,2001), [[UIScreen mainScreen] currentMode].size) || CGSizeEqualToSize(CGSizeMake(1242,2208), [[UIScreen mainScreen] currentMode].size)) : NO)
#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ?            CGSizeEqualToSize(CGSizeMake(1125,2436), [[UIScreen mainScreen] currentMode].size) : NO)

#ifdef DEBUG
#define NSLog(format, ...) printf("%s:(%d)  method: %s \n%s\n", [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __LINE__, __PRETTY_FUNCTION__, [[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String] )
#else
#define SLog(format, ...)
#endif
 
#endif /* Macros_h */

